import request from '@/utils/request'

const columnList = {
  name: {
    label: '全称',
    center: true,
    sort: true,
    show: true,
    type: 'string',
    disabled: false,
    width: 0,
    rule: () => {
      return new Error()
    }
  },
  alias: {
    label: '简称',
    center: true,
    sort: true,
    show: true,
    type: 'string',
    disabled: false,
    width: 0
  },
  lat: {
    label: '纬度',
    center: true,
    sort: true,
    show: false,
    type: 'string',
    disabled: false,
    width: 0
  },
  lng: {
    label: '经度',
    center: false,
    show: false,
    sort: true,
    type: 'string',
    disabled: false,
    width: 0
  },
  createTime: {
    label: '创建日期',
    center: true,
    sort: false,
    show: false,
    type: 'date',
    disabled: true,
    width: 0
  }
}

export function page(params) {
  return request({
    url: '/portal/scene/page',
    method: 'get',
    params
  })
}

export function getSceneList() {
  return request({
    url: '/portal/scene/wanring/list',
    method: 'get'
  })
}

export function del(id) {
  return request({
    url: '/portal/scene/' + id,
    method: 'delete'
  })
}

export function get(id) {
  return request({
    url: '/portal/scene/' + id,
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: `/portal/scene`,
    method: 'post',
    data
  })
}

export function update(data) {
  return request({
    url: `/portal/scene`,
    method: 'put',
    data
  })
}

export function sceneDevicePage(params) {
  return request({
    url: `/portal/scene/device/page`,
    method: 'get',
    params
  })
}

export function replace() {
  return request({
    url: `/portal/device/replace`,
    method: 'get'
  })
}

export function replaceone(data) {
  return request({
    url: `/portal/device/replace/one`,
    method: 'post',
    data
  })
}

export function bindDevice(data) {
  return request({
    url: `/portal/scene/bind`,
    method: 'post',
    data
  })
}

export function unbindDevice(params) {
  return request({
    url: `/portal/scene/nobind`,
    method: 'get',
    params
  })
}

export function sceneMeasureGroupList(params) {
  return request({
    url: `/portal/scene/measure_group/list`,
    method: 'get',
    params
  })
}

export function createMeasureGroup(data) {
  return request({
    url: `/portal/measure_group`,
    method: 'post',
    data
  })
}

export function deleteMeasureGroup(params) {
  return request({
    url: `/portal/measure_group/measure_group`,
    method: 'delete',
    params
  })
}

export function updateMeasureGroup(data) {
  return request({
    url: `/portal/measure_group`,
    method: 'put',
    data
  })
}

export function getMeasureGroupBaseList(params) {
  return request({
    url: `/portal/scene/by_scene/list`,
    method: 'get',
    params
  })
}

// 创建测量组-获取基准点
export function getBaseList(params) {
  return request({
    url: `/portal/measure_group/base_point/list`,
    method: 'get',
    params
  })
}

// 创建测量组-获取中控点
export function getControlList(params) {
  return request({
    url: `/portal/scene/getcontro_id`,
    method: 'get',
    params
  })
}

// 创建测量组-获取基准点
export function getCheckList(params) {
  return request({
    url: `/portal/measure_group/measure_point/list`,
    method: 'get',
    params
  })
}

export function columns() {
  return columnList
}
//测量组点位偏移数据
export function offset(params) {
  return request({
    url: '/portal/scene/offset',
    method: 'get',
    params
  })
}
//点位坐标
export function position(params) {
  return request({
    url: '/portal/scene/position',
    method: 'get',
    params
  })
}

export function getOffsetScene(params) {
  return request({
    url: '/portal/offset/' +params,
    method: 'get',
  })
}

export function putOffsetScene(data) {
  return request({
    url: '/portal/offset',
    method: 'put',
    data
  })
}
export function getDevice_byType(params) {
  return request({
    url: '/portal/scene/device_bytype' ,
    method: 'get',
    params
  })
}

export function getNew_offset(params) {
  return request({
    url: '/portal/scene/new/offset' ,
    method: 'get',
    params
  })
}

export function getXyz(params) {
  return request({
    url: '/portal/scene/position/getxyz' ,
    method: 'get',
    params
  })
}